#pragma once

#include "UIPageLoader.h"
#include "UIInterface.h"

namespace DirectUI
{
	enum UI_Internal_Message_ID
	{
		uimsgid_Timer,
	};

	class CUICore 
		: public CUINoAggregateObjectImplHelper<IUICore, CUICore, IUICore>
	{
		DECLARE_CLASS(CUICore, Core)
	public:
		CUICore();
		~CUICore();

		virtual BOOL					CreatePageLoaderInstance(IUIPageLoader** lppObj);
		virtual IUIObjectFactory*		GetUIObjectFactoryInstance();

		virtual BOOL					MainThreadMessageFilter(HWND hWnd, UINT uMsg, WPARAM wp, LPARAM lp);
		virtual DWORD					GetMainThreadID();
		virtual UINT					GetUIInternalMessageID();

		virtual IUIRender*				GetUIRender();
		virtual void					SetUIRender( IUIRender* lpRender );

		virtual IUIVisualStateManager*	GetUIVisualStateManager();

		virtual void					RunUILoop();
		virtual void					SetSkinDir(LPCTSTR lpszDir);
		virtual LPCTSTR					GetSkinDir();

	private:
		BOOL							Init();

	private:
		UINT								m_InternalMessageID;
		DWORD								m_dwMainThreadID;
		std::wstring						m_szSkinDir;
		CUIObjectPtr<IUIObjectFactory>		m_spUIObjectFactory;
		CUIObjectPtr<IUIRender>				m_spUIRender;

	public:
		CUIObjectPtr<IUIElement>		m_spCurMouseOverElement;
		CUIObjectPtr<IUIElement>		m_spCurMouseDownElement;
	};
};
